how to find sum of diagonal elements of a matrix in C